package com.epita.mgdc;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class StartActivity extends Activity {

	EditText etxt = null;
	Button bcall = null;
	Button bsave = null;
	Button bshow = null;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		etxt = (EditText) findViewById(R.id.eText);
		bcall = (Button) findViewById(R.id.callButton);
		bsave = (Button) findViewById(R.id.saveButton);
		bshow = (Button) findViewById(R.id.listButton);

		bcall.setOnClickListener(new OnClickListener() {
			public void onClick(View view) {
				if (etxt!= null) {
					Intent intent;
					intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"
							+ etxt.getText().toString()));
					startActivity(intent);
				}
			}
		});

		bsave.setOnClickListener(new OnClickListener() {
			public void onClick(View view) {
				Toast.makeText(getApplicationContext(), "Not implemented!", Toast.LENGTH_SHORT).show();
			}
		});

		bshow.setOnClickListener(new OnClickListener() {
			public void onClick(View view) {
				Intent myIntent = new Intent(view.getContext(),
						MGDCActivity.class);
				startActivityForResult(myIntent, 0);
			}
		});
	}
}
